import type { EquationProps } from "naive-ui";
import { NEquation } from "naive-ui";
import type { HTMLAttributes } from "vue";

export type EquationFactoryConstructorType = {
  props?: EquationProps;
  attrs?: HTMLAttributes;
};
export class EquationFactory {
  private props: EquationProps = {};
  private attrs: HTMLAttributes = {};

  constructor(data?: EquationFactoryConstructorType) {
    if (data?.props) this.setProps(data.props);
    if (data?.attrs) this.setAttrs(data.attrs);
  }
  setProps(props: EquationProps) {
    this.props = props;
    return this;
  }
  setAttrs(attrs: HTMLAttributes) {
    this.attrs = attrs;
    return this;
  }
  create() {
    return <NEquation {...this.props} {...this.attrs}></NEquation>;
  }
}
